package com.huang.auth.converter;

import com.huang.auth.constants.AuthConstants;
import com.huang.auth.entity.po.AuthMenuPO;
import com.huang.auth.entity.vo.AuthMenuSimpleVO;
import com.huang.base.core.BaseConvertor;
import org.springframework.stereotype.Component;


/**
 *  简单菜单 VO 转换 用于为菜单授权
 */
@Component
public class AuthMenuSimpleVOConverter extends BaseConvertor<AuthMenuPO, AuthMenuSimpleVO> {
    @Override
    public AuthMenuSimpleVO doConvert(AuthMenuPO m) {
        AuthMenuSimpleVO authMenuSimpleVO = new AuthMenuSimpleVO();
        // 菜单类型
        authMenuSimpleVO.setType(AuthConstants.SIMPLE_TYPE_MENU);
        authMenuSimpleVO.setId(m.getId().toString());
        authMenuSimpleVO.setTitle(m.getTitle());
        authMenuSimpleVO.setParentId(m.getParentId().toString());
        return authMenuSimpleVO;
    }
}
